import http from '../utils/http';

/**
 * 获取列表
 */
function getDataSources(){
    return new Promise((resolve, reject) => {
        http("get",'/metadata/metaDatasource/find').then(res => {
            //console.log("ap-------:"+res);
            resolve (res);
        },error => {
            console.log("网络异常~",error);
            reject(error)
        })
    })
}

function saveDS(param){
    return new Promise((resolve, reject) => {
        http("post",'/metadata/metaDatasource/save',param).then(res => {
            resolve (res);
        },error => {
            console.log("网络异常~",error);
            reject(error)
        })
    })
}


function delDS(param){
    return new Promise((resolve, reject) => {
        http("post",'/metadata/metaDatasource/remove',param).then(res => {
            //console.log("ap-------:"+res);
            resolve (res);
        },error => {
            console.log("网络异常~",error);
            reject(error)
        })
    })
}



function testConnection(param){
    return new Promise((resolve, reject) => {
        http("post",'/metadata/metaDatasource/getConnection',param).then(res => {
            //console.log("ap-------:"+res);
            resolve (res);
        },error => {
            console.log("网络异常~",error);
            reject(error)
        })
    })
}







export {
    getDataSources,saveDS,delDS,testConnection
}

